package com.qf.sy2103.ssm.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;


/**
 * 对应数据库的用户表
 */
@Data  // setter getter  toString
@AllArgsConstructor   // 生成一个全参数的构造函数  public User(int id ,String name,....){}
@NoArgsConstructor  // 生成一个无参的构造函数  public User();
public class User implements Serializable {

    // 两参构造函数
    public User(int id , String name){
        this.id = id;
        this.name = name;
    }

    private Integer id ;

    private String name;

    private String password;

    private String sex;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date registTime;

    private String auth;

    private String filename;

    public String toCSVString() {
        return id+","+name+","+password+","+sex+","+birthday+","+registTime+","+auth+","+filename;
    }
}
